package com.example.demo.day.config.learn.designBook.secondDay.part2;

import com.example.demo.day.config.learn.designBook.secondDay.part1.NovelBook;

public class OffNovelBook extends NovelBook {
    public OffNovelBook(String _name, int _price, String _author) {
        super(_name, _price, _author);
    }

    @Override
    public int getPrice() {
        //原价
        int selPrice = super.getPrice();
        int offPrice = 0;
        if (selPrice > 4000) {
            //原价大于40元，则打9折
            offPrice = selPrice * 90 / 100;
        } else {
            offPrice = selPrice * 80 / 100;
        }
        return offPrice;
    }
}
